feat: expose --use_directml CLI flag (experimental)#290
Merged
Conversation
Contributor (Vageesha Gupta) reported DirectML support exists (PR #211) but is unreachable from the CLI. Design: expose --use_directml as explicit opt-in, add conditional discoverability hint, document as experimental with an honest per-architecture status, ship a patch release, and reply inviting validation of untested architectures.
Correct spec to drop remote-CLI scope: DirectML is local-only and the remote separation servers run on CUDA/CPU, so plumbing use_directml through audio_separator/remote/* would be dead config. Add 5-task TDD plan (CLI flag, discoverability hint, README, version bump, reply draft).
Wire the existing Separator(use_directml=...) support (PR #211) to the CLI, mirroring --use_autocast. Explicit opt-in only. Adds the fixture key + a wiring test in test_cli.py.
…talled In the CPU-fallback path of setup_torch_device, if torch_directml or onnxruntime-directml is installed but DirectML wasn't enabled, log a one-line INFO hint pointing to --use_directml. Fires during 'audio-separator --env_info' on DirectML-capable machines.
New install section with the dml extra, --use_directml usage, env_info confirmation line, and an honest per-architecture status matrix. Also adds --use_directml to the ToC, the full CLI-options reference, and the Separator class parameters list.
0ecaf7a to
22567a8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Expose the existing DirectML acceleration through the CLI via a new
--use_directmlflag (experimental).Why
A contributor reported that DirectML support (added in #211) works when constructing
Separator(use_directml=True)from the Python API, but is unreachable from the CLI — there was no--use_directmlargument and it was never forwarded to the constructor. It was an oversight in the original PR, not an intentional gate. This wires it up so CLI users on Windows AMD/Intel GPUs can enable it without editing source.Changes
--use_directmlCLI flag (cli.py) — explicit opt-in, mirroring--use_autocast; forwarded into theSeparator(...)construction.separator.py) — in the CPU-fallback path ofsetup_torch_device, iftorch_directmloronnxruntime-directmlis installed but DirectML wasn't enabled, log a one-line hint pointing to--use_directml. Fires duringaudio-separator --env_infoon DirectML-capable machines.--use_directmladded to the ToC, the full CLI-options reference, and theSeparatorclass parameters list.test_cli.py) and two hint tests (test_directml.py).Design notes
torch_directmlinstalled would be an untestable silent-regression risk. The DirectML branch remains reachable only when CUDA and MPS are both unavailable, so this cannot affect CUDA/MPS/CPU users.audio_separator/remote/*would be dead config.Testing
tests/unit/test_cli.py+tests/unit/test_directml.py: 21 passed, 2 skipped. Full unit suite collects cleanly (276 tests). No DirectML execution test — that can't run in CI; only the CLI→constructor wiring and the hint are tested.Note:
test_cli_multiple_filenamesis a pre-existing, macOS-specific flaky test (amock_openpatch breaks stdlibplatform.platform()depending on import order) — it fails identically on the base branch and is unrelated to this change.@coderabbitai ignore